<?php 
header("content-type:text/html;charset=utf-8");
require_once'inc/conn.php';

    $user=$_POST['user'];
    $pass=$_POST['pass'];
    $sql="select * from admin where user='$user'";
    $result=mysql_query($sql);
    $str="";
    $status=0;
    if($rs=mysql_fetch_array($result)){
        if($rs['pass']==$pass){
            $str="登陆成功";
            session_start();
                    $_SESSION["ischeked"]="ok";
                    $_SESSION["user"]=$user;
            $status=100;
        }else{
            $str="密码错误";
            $status=1;
        }

    }else{
        $str="用户名错误";
        $status=2;
            }
    $json = array('str' => $str,'status' => $status);
    echo json_encode($json);
 ?>